# -*- coding: UTF-8 -*-

numbers = [98, 80, 94, 95, 85, 94, 85, 84, 98, 96, 95]

print("排序前：", numbers)

# 找出数据最大值
maxNum = numbers[0]
minNum = numbers[0]
for num in numbers:
    if num > maxNum:
        maxNum = num
    if num < minNum:
        minNum = num

# 声明统计数组
counters = [0] * (maxNum - minNum + 1)

# 开始计数
for num in numbers:
    counters[num - minNum] += 1

# 统计完毕，展开数组
sortIndex = 0
for num in range(minNum, maxNum + 1):
    while counters[num - minNum] > 0:
        numbers[sortIndex] = num
        sortIndex += 1
        counters[num - minNum] -= 1

print("排序后：", numbers)
